<?php
/**
 * Created by PhpStorm.
 * User: mac
 * Date: 2015/4/4
 * Time: 20:20
 */

namespace Admin\Controller;


class QRCodeController extends CommonController{


    public function makeQRCodeForUrl()
    {
        $act = $this->getString('act');
        if($act == 'make')
        {
            $status = 0;
            $url = $_POST['url'];
            $size = $_POST['size'];
            $set_logo = $_POST['set_logo'];
            if($url != '')
            {
                $status = 1;

                $logo = $set_logo == 1 ? './upload/sys/'.$this->_Cfg['logo'] : '';
                $rs = $this->makeQRCode($url,$logo,$size);
            }
            $rs['status'] = $status;

            echo json_encode($rs);
        }
        else
        {
            $url = '';
            $node = $this->getInt('node');
            if($node > 0)
            {
                $type = $this->getString('type');
                $url = $this->getUrlByNode($node,$type);
            }
            $this->assign('url',$url);
            $this->display();
        }

    }




} 